import os
import sys
import time
import string
import pdb

argv = sys.argv

input_file = argv[1]
output_file = argv[2]

f_in = open( input_file, 'r' )
f_out = open( output_file, 'w' )

for line in f_in.readlines():
	line_out = []
	cur_line = line.rsplit( ';' )
	aus_tree_in = cur_line[5].rsplit( '|' )
	aus_tree_out = []
	
	for i in aus_tree_in:
		if i != '':
			aus_tree_out.append( i )

	line_out.append( string.join( aus_tree_out, ',' ) )
	
	s_out = cur_line[6].replace( ' ' , '' ).rsplit('Hors')
	#pdb.set_trace()
	if len(s_out):
		has_out_of_page = 1
	else:
		has_out_of_page = 0
		
	sizes_out = []
	for s in s_out[0].rsplit(','):
		if s.upper().find( 'HORS' ) != (-1):
			test = 0
		else:
			sizes_out.append(s)
		
	line_out.append( string.join( sizes_out, ',' ) )
	line_out.append( cur_line[7] )

	if cur_line[8][0] == 'T':
		line_out.append('TRUE')
	else:
		line_out.append('FALSE')

	
	line_out_s = string.join(line_out,'^') + '\n'
	
	# pdb.set_trace()
	f_out.write( line_out_s )
		
		
		
	
